#pragma once
#include "williams2machine.h"
#include "apu/ym2151/ym2151.h"

class CJoust2Machine:public CWilliams2Machine
{
protected:
	CDead6809 *SoundCPU2;
	C6821 *PIA3;					//has a fourth pia
	void *YM2151;
	u8 SoundRAM2[0x800];
	u8 YM2151Register;
	u8 SoundBankData;
	u8 *SoundBankPtr;
protected:
	void SetSoundBank(u8 data);
public:
	CJoust2Machine();
	virtual ~CJoust2Machine();
	virtual int Init();
	virtual void Reset();
	virtual void Line(u32 mainc,u32 soundc,int irq);
	virtual void SaveState(CState *s);
	virtual void LoadState(CState *s);
	static u8 ReadSoundCPU2(void *user,u32 addr);
	static void WriteSoundCPU2(void *user,u32 addr,u8 data);
	static u8 PIA0_InputA_Mux(void *user);
	static void PIA0_OutputCB2_Mux(void *user,u8 data);
};
